#ifndef __OPENSSL_RSAUTIL_H__
#define __OPENSSL_RSAUTIL_H__

#include <stdio.h>
#include <string.h>

#include "openssl/pem.h"
#include "openssl/err.h"
#include "openssl/rsa.h"
#include "openssl/evp.h"
#include "openssl/engine.h"

#include "Base64Util.h"
#include "Logger.h"

#ifndef BASE64_WITHIN
#define BASE64_WITHIN
#endif

#ifndef ENTRY_TEST
#define ENTRY_TEST
#endif

#ifndef BASE64_TEST
#define BASE64_TEST
#endif

#ifndef BUFFER_SIZE
#define BUFFER_SIZE 1024
#endif

void printLastError();

int rsa_public_encrypt(const char *public_key_path,
                       unsigned char *from, size_t from_len,
                       unsigned char **to, size_t *to_len);
int rsa_private_decrypt(const char *private_key_path,
                           unsigned char *in, size_t in_len,
                        unsigned char **out, size_t *out_len);

#endif /* __OPENSSL_RSAUTIL_H__ */